package com.itheima.health.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import com.itheima.health.pojo.Member;
import com.itheima.health.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.cache.annotation.CacheEvict;

/**
 * @author
 * @Date 2023/9/3 12:06
 * @Version 1.0
 */
@Mapper
public interface MemberDao {

/**
 * @author ：zhang
 * @date ：Created in 2019/11/20
 * @description ：用户DAO
 * @version: 1.0
 */

    /**
     * 根据phone查询会员
     * @param phoneNumber
     * @return
     */
    @Select("SELECT * FROM t_member WHERE phoneNumber=#{phoneNumber} ")
    Member getByPhone(String phoneNumber);

    /**
     * 更新会员
     * @param
     * @return
     */
    void update(@Param("member") Member member);

    /**
     * 新增会员
     * @param member
     */
    void insert(@Param("member")Member member);

    /**
     * 根据id查询会员
     * @param id
     * @return
     */
    @Select("SELECT * FROM t_member WHERE id=#{id} ")
    Member getById(Integer id);

    /**
     * 获取指定时间内的会员数量
     */
    Integer getMemberCountByRegTime(@Param("month") LocalDate month,@Param("month2") LocalDate month2);

    Member selectByIdCard(@Param("idCard") String idCard);

    void save(@Param("member") Member member);

    Member selectById(@Param("id") Integer id);
}
